# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        博智科技  
# Name:         demo42
# Description:  闭包的理解
# Author:       yzl
# Date:         2019-02-19
#-------------------------------------------------------------------------------
i = 2 # 全局变量

def funcA(x):
    index = 0
    print('funcA')
    index += 2
    print('funcA',index)
    # return None
    def funcB(y=0):
        print('funcB',index)
        print(funcB)
        if y:
            ret = x * y * i
        else:
            ret = x * index * i
        return ret
    return funcB

if __name__ == '__main__':
    funcC11 = funcA(3)   # 返回值为函数类型 funcB
    print('funcC',type(funcC11))
    result1 = funcC11()
    print(result1)

    result1 = funcC11()
    print(result1)

    result2 = funcA(3)(6) # 柯里化
    print(result2)

